Conditions | 7 |
Paths | 4 |
Total Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Changes | 3 | ||
Bugs | 0 | Features | 0 |
1 | /** |
||
15 | exports.formatDates = (model, formatString) => { |
||
16 | if (model instanceof Array) { |
||
17 | for (let i = 0; i < model.length; i++) { |
||
18 | model[i] = exports.formatDates(model[i], formatString); |
||
19 | } |
||
20 | } else if (model instanceof Date || model instanceof moment) { |
||
21 | return exports.formatDate(model, formatString); |
||
22 | } else if (model instanceof Object) { |
||
23 | const keys = Object.keys(model); |
||
24 | for (let i = 0; i < keys.length; i++) { |
||
25 | model[keys[i]] = exports.formatDates(model[keys[i]], formatString); |
||
26 | } |
||
27 | } |
||
28 | return model; |
||
29 | }; |
||
30 | |||
51 |